<template>
  <div>
    <p>eat: {{obj.hobby.eat}}</p>
    <button @click="obj.hobby.eat = '🍜'">update</button>
  </div>
</template>

<script>
import { reactive, watch } from 'vue';

export default {
  setup() {
    const obj = reactive({
      name: 'ifer',
      hobby: {
        eat: '西瓜',
      },
    })

    // !#1 watch 监听 reactive 数据，是递归监听的，并且配置无效
    watch(obj, (newValue, oldValue) => {
      // !#2 监听 reactive 对象，newValue 和 oldValue 是一样的
      console.log(newValue === oldValue)
    }, {
      deep: false // 配置无效
    })

    return {
      obj
    }
  }
}
</script>

<style lang="scss" scoped></style>